﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Kooboo.Commerce
{
    public static class ProductAttributeCommand
    {
        public static List<string> Validate(this IProductAttribute attribute, string value)
        {
            List<string> messages = new List<string>();
            foreach (var i in attribute.ValidationRules)
            {
                if (i.Validator.Validate(value, i.Parameters) == false)
                {
                    messages.Add(i.ErrorMessage);
                }
            }

            return messages;
        }
    }
}
